import request from '@/common/request.js';

//获取号码池中没有绑定坐席的号码，默认10条，并更改为当前坐席
export function getSeatCallOutByNoSeat(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getSeatCallOutByNoSeat',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取当前坐席所属项目下的任务
export function getTaskByProjectAndSeat(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getTaskByProjectAndSeat',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取外呼任务列表
export function getSeatCallOutList(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getSeatCallOutList',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取外呼订单列表
export function getSeatCallOrderListPro(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getSeatCallOrderListPro',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取外呼订单详情及项目扩展字段
export function getOrderGroup(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getOrderGroup',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取客户信息详情及项目扩展字段
export function getCustomerInfoByTidGroup(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getCustomerInfoByTidGroup',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//保存客户数据
export function updateCustomerInfoGroup(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/updateCustomerInfoGroup',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//生成订单
export function addOrderPro(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/addOrderPro',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//保存订单
export function updateOrder(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/updateOrder',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//保存订单 --多产品
export function updateOrderPro(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/updateOrderPro',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//根据坐席获取当前坐席下的 扩展字段
export function getProjectDataBySeatGroup(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/getProjectDataBySeatGroup',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//生成任务订单
export function createCallOrder(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/createCallOrder',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//保存订单
export function saveCallOrder(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/saveCallOrder',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//保存任务
export function saveCallOut(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/saveCallOut',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取半小时内的提醒数量
export function getOrderRemindCount(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/getOrderRemindCount',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//判断号码是否为黑名单
export function checkNumberType(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/checkNumberType',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//判断号码是否为黑名单 -- 新接口
export function checkNumberTypePV(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/checkNumberTypePV',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//更新已有的数据检测状态
export function callOutFilterCurrentData(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/callOutFilterCurrentData',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//更新已有的数据检测状态 -- 单条检测
export function callOutFilterCurrentDataByOne(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/callOutFilterCurrentDataByOne',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//保存手动添加任务
export function saveAddCallOut(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/saveAddCallOut',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//获取初始状态的所有外呼号码列表
export function getAllCallOutListByStatus(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Task/getAllCallOutListByStatus',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//呼叫前修改客户数据表里的号码状态 status=1
export function changeCallNumStatus(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/AppIndex/changeCallNumStatus',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}

//呼叫前修改客户数据表里的号码状态 status=1
export function getClickToDial(params) {
	let baseApiUrl = uni.getStorageSync("baseApiUrl");
	let base_url = 'http://' + baseApiUrl + '/';
	
	return request.httpRequest({
		url: base_url + 'api/Callout/getClickToDial',
		method: 'post',
		loading: true,
		requestHeader: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}, params);
}